{include file='ebcms@common/header' /}
{php}
    $channel = \app\content\model\Channel::order('sort desc,id asc') -> select();
    $channels = [];
    \ebcms\Tree::leveltree(\ebcms\Tree::tree($channel),$channels);
    //var_dump($channels);die;
{/php}
<div class="layout">
    <div class="layout-left" style="width: 250px;margin-right: -250px;">
        <div class="container-fluid">
            <div class="row">
                <div class="col-md-12">
                    <h3>内容管理</h3>
                    <div class="list-group">
                        {foreach name='channels' item='vo'}
                        {switch name='vo.type'}
                            {case value='jump'}
                            <a href="{:url('content/admin.channel/edit?id='.$vo['id'])}" class="list-group-item" target="right">
                                <span class="badge">跳转</span>
                                <span>{$vo._level|str_repeat='&nbsp;&nbsp;&nbsp;',###}┣</span>
                                {$vo.title}
                            </a>
                            {/case}
                            {case value='page'}
                            <a href="{:url('content/admin.channel/edit?id='.$vo['id'])}" class="list-group-item" target="right">
                                <span class="badge">单页</span>
                                <span>{$vo._level|str_repeat='&nbsp;&nbsp;&nbsp;',###}┣</span>
                                {$vo.title}
                            </a>
                            {/case}
                            {default/}
                            <a href="{:url('index?channel_id='.$vo['id'])}" class="list-group-item" target="right"><span>{$vo._level|str_repeat='&nbsp;&nbsp;&nbsp;',###}┣</span>{$vo.title}</a>
                        {/switch}
                        {/foreach}
                    </div>
                </div>
            </div>
        </div>
    </div>
    <div class="layout-rightbox">
        <div class="layout-right" style="height:100%;overflow:auto;margin-left: 250px;">
            <iframe name="right" id="right" frameborder="0" style="width:100%;height:100%;display: block;"></iframe>
        </div>
    </div>
</div>
{include file='ebcms@common/footer' /}